<?php
/**
 * 过滤
 * @author china_php<china_php@hotmail.com>
 * @version		1.0 - 2010-03-30
 * @package		Libs/biz
 */
class pf_filter
{

	public static function filer($contents, $type='text')
	{
		switch ($type)
		{
			case 'text':
				$contents = self::filter_text($contents);
				break;
			case 'html':
				$contents = self::filter_html($contents);
				break;
			default:
				$contents = self::filter_text($contents);
				break;
		}
		return $contents;
	}

	//输出安全的html
	public static function filter_html($text)
	{

		return $text;
	}

	public static function  filter_text($contents)
	{
		$contents = self::daddslashes($contents);
		return $contents;
	}

	public static function daddslashes($contents)
	{
		if (get_magic_quotes_gpc() == 1 && !is_array($contents))
		{
			$contents = stripslashes($contents);
		}

		return $contents;
	}

	public static function dstripslashes($contents)
	{
		return stripslashes($contents);
	}

}
?>